#ifndef SC_POINTS_H
#define SC_POINTS_H
// types and file reading


#include <cstdio>
#include <cmath>

#define PI 3.14159

using namespace std;

typedef unsigned int uint;
typedef long double ldouble;

// TODO vec-vec aritmethics; vec-const aritmethics
class vec{
public:
	float x, y;
	vec(float x = 0.0f, float y = 0.0f): x(x), y(y) {}
	vec(const vec& v): x(v.x), y(v.y) {}

	vec& operator =(const vec& v);
	vec& operator +=(const vec& v);
	vec& operator -=(const vec& v);
	vec& operator +=(float k);
	vec& operator -=(float k);
	vec& operator *=(float k);
	vec& operator /=(float k);
	vec operator -();

	vec operator +(const vec& v);
	vec operator -(const vec& v);
	vec operator +(float k);
	vec operator -(float k);
	vec operator *(float k);
	vec operator /(float k);

	vec& operator ()(float xx, float yy);

//---------------- comparing ----------------------
//------ return 1st bit 1 if left y > right y -----
//------ return 2nd bit 1 if left x > right x -----
	short operator ==(const vec& k) const;

    // gets float lenght
	float len();

    // gets arctan of y/x
	float arct();

};

vec operator *(float k, const vec& v);

class point{
public:
	vec pos, vel, fo, dpos, dvel;
	float mass;

	// to mark dragged point
    bool act;
	point (uint mass = 00): mass(mass), act(0) {};
};

class wire{
public:
	point* ps;
	point* pe;
	float angl;
	float rest;
	vec len;
	float koof;
	wire (point* ps = NULL, point* pe = NULL,
		float koof = 1.0): ps(ps), pe(pe), koof(koof) {}
	void length(vec a, vec b);
	void length();
};

void getpoints(point* &p, uint &size);
void getwires(wire* &w, uint &wsize, point* p, uint &size);

#endif
